package com.zhiche.lisa.bms.controller.statistics;

import com.zhiche.lisa.bms.service.statistics.StaticOrderCompositeService;
import com.zhiche.lisa.bms.service.statistics.StaticWaybillCompositeService;
import com.zhiche.lisa.core.enums.CommonEnum;
import com.zhiche.lisa.core.supports.RestfulResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: linbao
 * @date: 2019-03-15
 */
@RestController
@RequestMapping("/staticCommon")
@Api(value = "/staticCommon", description = "统计分析接口", tags = {"统计分析执行转化同步接口"})
public class StaticCommonController {

    @Autowired
    private StaticOrderCompositeService staticOrderCompositeService;

    @Autowired
    private StaticWaybillCompositeService staticWaybillCompositeService;


    @ApiOperation(value = "统计订单转换", notes = "统计订单转换", httpMethod = "POST")
    @PostMapping("/startOrderComposite")
    public RestfulResponse<String> startOrderComposite() {
        RestfulResponse<String> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
        staticOrderCompositeService.insertOrderComposite();
        return restful;
    }

    @ApiOperation(value = "统计运单转换", notes = "统计运单转换", httpMethod = "POST")
    @PostMapping("/startWaybillComposite")
    public RestfulResponse<String> startWaybillComposite() {
        RestfulResponse<String> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
        staticWaybillCompositeService.insertWaybillComposite();
        return restful;
    }
}
